<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui">
<h:head>
<h:outputStylesheet library="css" name="default.css" target="head" />
</h:head>
<h:body>
#{friendPresBean.onLoadGift()}
<h:form id="form">
	 <p:dataGrid var="pack" value="#{friendPresBean.pacchettiUtente}" columns="3"  
        rows="12" paginator="true"  
        paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"  
        rowsPerPageTemplate="9,12,15">  

        <p:panel header="#{pack.pacchettoOriginale.nome}" style="text-align:center">  
            <h:panelGrid columns="1" style="width:100%">  
               	<p:commandLink update=":form:packDetail" oncomplete="PF('packDialog').show()" title="View Detail">  
                    <h:outputText styleClass="ui-icon ui-icon-search" style="margin:0 auto;" />   
                    <f:setPropertyActionListener value="#{pack}" target="#{friendPresBean.pacchettoInCarrello}" />  
                </p:commandLink>  
            </h:panelGrid>  
        </p:panel>  
  
    </p:dataGrid>  
  	<p:dialog header="Car Detail" widgetVar="packDialog" modal="true">  
        <p:outputPanel id="packDetail" style="text-align:center;">  
               <p:growl id="growl" showDetail="true" sticky="true" /> 
            <h:panelGrid  columns="2" cellpadding="5">  
                 <p:dataTable var="pkHotel" value="#{friendPresBean.pacchettoInCarrello.hotelsInGL}" id="Hotel" >  
	               <p:column headerText="nome">  
				            <h:outputText value="#{pkHotel.hotel.nome}" />  
				   </p:column> 
			       <p:column headerText="n° Persone">  
			            <h:outputText value="#{pkHotel.numeroPersone}" />  
			       </p:column>  
			       <p:column headerText="Loc">  
			        	<h:outputText value="#{pkHotel.hotel.localita.nome}" />  
			       </p:column> 
			        <p:column headerText="Pagante">  
			        	<h:outputText value="#{pkHotel.giftList.pagante.firstName}" /> <br></br>
			        	<h:outputText value="#{pkHotel.giftList.pagante.lastName}" />  
			       </p:column> 
			        <p:column headerText="r">
			       <p:commandButton value="Regala" action="#{friendPresBean.regalaHotel}" update=":form:growl">
			        			<f:setPropertyActionListener value="#{pkHotel}" target="#{friendPresBean.pagaHotel}" />
			       </p:commandButton>
			      </p:column>
			    </p:dataTable>
			
			    <h:outputText id="descrizioneHeaderTourScelti" value="Tour scelti:" />   
			  <p:dataTable var="pkTour" value="#{friendPresBean.pacchettoInCarrello.toursInGL}" id="Tour">  
			        
			        <p:column headerText="nome">  
			            <h:outputText value="#{pkTour.tour.descrizione}" />  
			        </p:column>     
			         <p:column headerText="n° persone">  
			            <h:outputText value="#{pkTour.numeroPersone}" />  
			        </p:column> 
			        <p:column headerText="Loc">  
			           <h:outputText value="#{pkTour.tour.localita.nome}" />  
			        </p:column> 
			         <p:column headerText="Pagante">  
			        	<h:outputText value="#{pkTour.giftList.pagante.firstName}" /> <br></br>
			        	<h:outputText value="#{pkTour.giftList.pagante.lastName}" />  
			       </p:column> 
			       <p:column>
			          <p:commandButton value="Regala" action="#{friendPresBean.regalaTour}" update=":form:growl">
			        		<f:setPropertyActionListener value="#{pkTour}" target="#{friendPresBean.pagaTour}" />
			       			</p:commandButton>
			       </p:column>
			    </p:dataTable>
			    
			    <h:outputText id="descrizioneHeaderVoliScelti" value="Voli scelti:" />   
			   <p:dataTable var="pkVolo" value="#{friendPresBean.pacchettoInCarrello.voliInGL}" id="Volo">  
			        <p:column headerText="Da aeroporto">  
			            <h:outputText value="#{pkVolo.trattaVolo.daAeroporto.name}" />  
			        </p:column>  
			         <p:column headerText="A aeroporto">  
			            <h:outputText value="#{pkVolo.trattaVolo.aAeroporto.name}" />  
			        </p:column>   
			        <p:column headerText="Compagnia">  
			            <h:outputText value="#{pkVolo.trattaVolo.compagnia.nome}" />  
			        </p:column>
			        <p:column headerText="numero volo">  
			            <h:outputText value="#{pkVolo.numeroPersone}" />  
			        </p:column>
			          <p:column headerText="Pagante">  
			        	<h:outputText value="#{pkVolo.giftList.pagante.firstName}" /> <br></br>
			        	<h:outputText value="#{pkVolo.giftList.pagante.lastName}" />  
			       </p:column> 
			       <p:column>
			          <p:commandButton value="Regala" action="#{friendPresBean.regalaTour}" update=":form:growl">
			        		<f:setPropertyActionListener value="#{pkVolo}" target="#{friendPresBean.pagaVolo}" />
			          </p:commandButton>
			        </p:column>
			    </p:dataTable> 
            </h:panelGrid>   
        </p:outputPanel>  
    </p:dialog>
    
    
    
 </h:form>
</h:body>
</html>